#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Views for the members app.
#
# Created on 2008-10-28.
# $Id: views.py 40 2010-03-08 23:05:09Z guolin.mobi $
#

import logging

from django.template import loader
from django.template import Context
from django.http import HttpResponse
from afcpweb.apps.activities.config import Config
from afcpweb.apps.common.actions import get_common_data
from afcpweb.apps.activities.models import AFCPActivity

def home(request):
    ctxt_dict = {}
    ctxt_dict.update(get_common_data(request))
    ctxt = Context(ctxt_dict)
    tmpl = loader.get_template("%s/home.html" % Config.APP_NAME)
    return HttpResponse(tmpl.render(ctxt))

def show_activity(request,uid):

    activity = AFCPActivity.get_unique(uid)
    if request.method == "GET":
        ctxt_dict = { "activity"      : activity,}
        ctxt_dict.update(get_common_data(request))
        ctxt = Context(ctxt_dict)
        tmpl = loader.get_template("%s/show_activity.html" % Config.APP_NAME)
        return HttpResponse(tmpl.render(ctxt))
    else :
        return not_found(request)

#